<?php
namespace app\admin\controller;
class Log extends Action
{

    public function index()
    {

        return $this->fetch('index');

    }
    public function lists(){
        $pagesize = input('pagesize'); 
        $pages = input('pages');
        if($pages<=1)
            $a = 0;
        else
            $a = $pagesize*($pages-1);

        $total = db("guanli_log")->count();
        $totalpage = ceil($total/$pagesize);
        $data = db("guanli_log")->alias("a")
                ->order("a.ma_addtime","desc")
                ->limit($a,$pagesize)
                ->field('a.*,FROM_UNIXTIME(a.ma_addtime,"%Y年%m月%d日 %H:%i") as ma_addtime')
                ->select();
        //输出Json数据
    	return json(['code'=>1,'message'=>"获取数据成功",'data'=>$data,'totalpage'=>$totalpage]);

    }
    public function delete(){
        if(db("guanli_log")->where("id",input("id"))->delete())
            return 1;
        else
            return 0;

    }


}

